{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <!-- 表单头部 -->
                <div class="card-header">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fas fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post" enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="card-body">
                        <div class="form-group row rowText">
    <label for="company_name" class="col-sm-2 col-form-label">公司名称</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="company_name" name="company_name" value="{$data.company_name|default=''}" placeholder="请输入公司名称" type="text" class="form-control fieldText">
    </div>
</div>
    <div class="form-group row rowImage">
        <label for="license" class="col-sm-2 col-form-label">营业执照照片</label>
        <div class="col-sm-10 col-md-4 formInputDiv"> 
            <div class="input-group">
                <input id="license_file" name="license_file" type="file" class="file-loading " data-initial-preview="{if isset($data)}{$data.license}{/if}">
                <input name="license" id="license" value="{$data.license|default=''}" hidden placeholder="请上传图片" class="fieldImage">
                <script>
                     initUploadImg('license');
                </script>            
            </div>
        </div>
    </div>   
    <div class="form-group row rowText">
    <label for="code" class="col-sm-2 col-form-label">统一社会信用代码</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="code" name="code" value="{$data.code|default=''}" placeholder="请输入统一社会信用代码" type="text" class="form-control fieldText">
    </div>
</div>
    <div class="form-group row rowImage">
        <label for="food" class="col-sm-2 col-form-label">食品经营许可证</label>
        <div class="col-sm-10 col-md-4 formInputDiv"> 
            <div class="input-group">
                <input id="food_file" name="food_file" type="file" class="file-loading " data-initial-preview="{if isset($data)}{$data.food}{/if}">
                <input name="food" id="food" value="{$data.food|default=''}" hidden placeholder="请上传图片" class="fieldImage">
                <script>
                     initUploadImg('food');
                </script>            
            </div>
        </div>
    </div> 
    <div class="form-group row rowImage">
        <label for="id_card_top" class="col-sm-2 col-form-label">法人身份证正面</label>
        <div class="col-sm-10 col-md-4 formInputDiv"> 
            <div class="input-group">
                <input id="id_card_top_file" name="id_card_top_file" type="file" class="file-loading " data-initial-preview="{if isset($data)}{$data.id_card_top}{/if}">
                <input name="id_card_top" id="id_card_top" value="{$data.id_card_top|default=''}" hidden placeholder="请上传图片" class="fieldImage">
                <script>
                     initUploadImg('id_card_top');
                </script>            
            </div>
        </div>
    </div>    <div class="form-group row rowImage">
        <label for="id_card_back" class="col-sm-2 col-form-label">法人身份证反面</label>
        <div class="col-sm-10 col-md-4 formInputDiv"> 
            <div class="input-group">
                <input id="id_card_back_file" name="id_card_back_file" type="file" class="file-loading " data-initial-preview="{if isset($data)}{$data.id_card_back}{/if}">
                <input name="id_card_back" id="id_card_back" value="{$data.id_card_back|default=''}" hidden placeholder="请上传图片" class="fieldImage">
                <script>
                     initUploadImg('id_card_back');
                </script>            
            </div>
        </div>
    </div>
    <div class="form-group row rowImage">
        <label for="food_inspector" class="col-sm-2 col-form-label">食品检测员（高级）</label>
        <div class="col-sm-10 col-md-4 formInputDiv"> 
            <div class="input-group">
                <input id="food_inspector_file" name="food_inspector_file" type="file" class="file-loading " data-initial-preview="{if isset($data)}{$data.food_inspector}{/if}">
                <input name="food_inspector" id="food_inspector" value="{$data.food_inspector|default=''}" hidden placeholder="请上传图片" class="fieldImage">
                <script>
                     initUploadImg('food_inspector');
                </script>            
            </div>
        </div>
    </div>
    <div class="form-group row rowMultiImage">
    <label for="health" class="col-sm-2 col-form-label">经营人员健康证（5）</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="health_file" name="health_file" type="file" class="file-loading " multiple>
            <input name="health" id="health" value="{$data.health|default=''}" hidden placeholder="请上传图片" class="fieldMultiImage">
            <script>
                initUploadMultiImg('health');
            </script>            
        </div>
    </div>
</div>
    <div class="form-group row rowMultiImage">
    <label for="performance" class="col-sm-2 col-form-label">业绩证明</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="performance_file" name="performance_file" type="file" class="file-loading " multiple>
            <input name="performance" id="performance" value="{$data.performance|default=''}" hidden placeholder="请上传图片" class="fieldMultiImage">
            <script>
                initUploadMultiImg('performance');
            </script>            
        </div>
    </div>
</div>
    <div class="form-group row rowMultiSelect">
    <label for="cate" class="col-sm-2 col-form-label">所属类目</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <select name="cate[]" id="cate" data-placeholder="请选择所属类目" class="form-control fieldMultiSelect" multiple="multiple">
            <option value=""></option>
                     {foreach name='cate_list' id='item'}
        <option value="{$item.id}" {if isset($data) && in_array($item.id,$data.cate)}selected{/if}>{$item.name}</option>
        {/foreach}



        </select>
    </div>

    <script>
        $('#cate').select2();
    </script>
</div>
<div class="form-group row rowText">
    <label for="nature" class="col-sm-2 col-form-label">公司性质</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="nature" name="nature" value="{$data.nature|default=''}" placeholder="请输入公司性质" type="text" class="form-control fieldText">
    </div>
</div>
<div class="form-group row rowText">
    <label for="aptitude" class="col-sm-2 col-form-label">纳税人资质</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="aptitude" name="aptitude" value="{$data.aptitude|default=''}" placeholder="请输入纳税人资质" type="text" class="form-control fieldText">
    </div>
</div>
<div class="form-group row rowText">
    <label for="name" class="col-sm-2 col-form-label">联系人姓名</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="name" name="name" value="{$data.name|default=''}" placeholder="请输入联系人姓名" type="text" class="form-control fieldText">
    </div>
</div>
<div class="form-group row rowMobile">
    <label for="phone" class="col-sm-2 col-form-label">手机号</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="phone" name="phone" value="{$data.phone|default=''}" placeholder="请输入手机号" type="tel" maxlength="11" class="form-control fieldMobile">
    </div>
</div>
<div class="form-group row rowText">
    <label for="email" class="col-sm-2 col-form-label">邮箱</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="email" name="email" value="{$data.email|default=''}" placeholder="请输入邮箱" type="text" class="form-control fieldText">
    </div>
</div>
<div class="form-group row rowTextarea">
    <label for="address" class="col-sm-2 col-form-label">经营场地地址</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <textarea id="address" name="address" class="form-control" rows="3" placeholder="请输入经营场地地址" >{$data.address|default=''}</textarea>
    </div>
</div>
<div class="form-group row rowText">
    <label for="area" class="col-sm-2 col-form-label">面积</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="area" name="area" value="{$data.area|default=''}" placeholder="面积" type="text" class="form-control fieldText">
    </div>
</div>
<div class="form-group row rowText">
    <label for="equity" class="col-sm-2 col-form-label">产权</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="equity" name="equity" value="{$data.equity|default=''}" placeholder="产权" type="text" class="form-control fieldText" >
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="equity_cert" class="col-sm-2 col-form-label">产权证明</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="equity_cert_file" name="equity_cert_file" type="file" class="file-loading " multiple>
            <input name="equity_cert" id="equity_cert" value="{$data.equity_cert|default=''}" hidden placeholder="请上传产权证明" class="fieldMultiImage">
            <script>
                initUploadMultiImg('equity_cert');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="car" class="col-sm-2 col-form-label">车辆</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="car_file" name="car_file" type="file" class="file-loading " multiple>
            <input name="car" id="car" value="{$data.car|default=''}" hidden placeholder="请上传车辆" class="fieldMultiImage">
            <script>
                initUploadMultiImg('car');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="car_num1" class="col-sm-2 col-form-label">常温车数量</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="car_num1_file" name="car_num1_file" type="file" class="file-loading " multiple>
            <input name="car_num1" id="car_num1" value="{$data.car_num1|default=''}" hidden placeholder="请上传常温车数量" class="fieldMultiImage">
            <script>
                initUploadMultiImg('car_num1');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="car_num2" class="col-sm-2 col-form-label">冷藏车数量</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="car_num2_file" name="car_num2_file" type="file" class="file-loading " multiple>
            <input name="car_num2" id="car_num2" value="{$data.car_num2|default=''}" hidden placeholder="请上传冷藏车数量" class="fieldMultiImage">
            <script>
                initUploadMultiImg('car_num2');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowSwitch">
    <label for="is_car" class="col-sm-2 col-form-label">是否具备运输系统</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
    <input {if((!isset($data)&&1==1)||(isset($data)&&$data.is_car==1))}checked{/if}
     class="input-switch"  id="is_car" value="1" type="checkbox" />
    <input class="switch fieldSwitch" placeholder="是否具备运输系统" name="is_car" value="{$data.is_car|default='1'}" hidden />
    </div>

    <script>
        $('#is_car').bootstrapSwitch({
            onText: "是",
            offText: "否",
            onColor: "success",
            offColor: "danger",
            onSwitchChange: function (event, state) {
                $(event.target).closest('.bootstrap-switch').next().val(state ? '1' : '0').change();
            }
        });
    </script>
</div>
<div class="form-group row rowMultiImage">
    <label for="food_insurance" class="col-sm-2 col-form-label">食品保险</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="food_insurance_file" name="food_insurance_file" type="file" class="file-loading " multiple>
            <input name="food_insurance" id="food_insurance" value="{$data.food_insurance|default=''}" hidden placeholder="请上传食品保险" class="fieldMultiImage">
            <script>
                initUploadMultiImg('food_insurance');
            </script>            
        </div>
    </div>
</div>

<div class="form-group row rowText">
    <label for="sum_insured" class="col-sm-2 col-form-label">保额</label>
    <div class="col-sm-10 col-md-4 formInputDiv">
        <input id="sum_insured" name="sum_insured" value="{$data.sum_insured|default=''}" placeholder="保额" type="text" class="form-control fieldText">
    </div>
</div>

<div class="form-group row rowMultiImage">
    <label for="social_security" class="col-sm-2 col-form-label">纳税证明.社保（6月）</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="social_security_file" name="social_security_file" type="file" class="file-loading " multiple>
            <input name="social_security" id="social_security" value="{$data.social_security|default=''}" hidden placeholder="请上传纳税证明.社保（6月）" class="fieldMultiImage">
            <script>
                initUploadMultiImg('social_security');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="iso9001" class="col-sm-2 col-form-label">国家企业信用信息公示系统查询结果截图</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="iso9001_file" name="iso9001_file" type="file" class="file-loading " multiple>
            <input name="iso9001" id="iso9001" value="{$data.iso9001|default=''}" hidden placeholder="请上传国家企业信用信息公示系统查询结果截图" class="fieldMultiImage">
            <script>
                initUploadMultiImg('iso9001');
            </script>            
        </div>
    </div>
</div>
<!-- <div class="form-group row rowMultiImage">
    <label for="iso14001" class="col-sm-2 col-form-label">环境管理体系（ISO14001）认证证书</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="iso14001_file" name="iso14001_file" type="file" class="file-loading " multiple>
            <input name="iso14001" id="iso14001" value="{$data.iso14001|default=''}" hidden placeholder="请上传产权证明" class="fieldMultiImage">
            <script>
                initUploadMultiImg('iso14001');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="haccp" class="col-sm-2 col-form-label">HACCP 体系认证证书</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="haccp_file" name="haccp_file" type="file" class="file-loading " multiple>
            <input name="haccp" id="haccp" value="{$data.haccp|default=''}" hidden placeholder="请上传产权证明" class="fieldMultiImage">
            <script>
                initUploadMultiImg('haccp');
            </script>            
        </div>
    </div>
</div>
<div class="form-group row rowMultiImage">
    <label for="cnas" class="col-sm-2 col-form-label">CNAS检测报告</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="cnas_file" name="cnas_file" type="file" class="file-loading " multiple>
            <input name="cnas" id="cnas" value="{$data.cnas|default=''}" hidden placeholder="请上传产权证明" class="fieldMultiImage">
            <script>
                initUploadMultiImg('cnas');
            </script>            
        </div>
    </div>
</div> -->
<div class="form-group row rowMultiImage">
    <label for="other" class="col-sm-2 col-form-label">其他资质</label>
    <div class="col-sm-10 col-md-8 formInputDiv">
        <div class="input-group">
            <input id="other_file" name="other_file" type="file" class="file-loading " multiple>
            <input name="other" id="other" value="{$data.other|default=''}" hidden placeholder="请上传图片" class="fieldMultiImage">
            <script>
                initUploadMultiImg('other');
            </script>            
        </div>
    </div>
</div>


                    </div>
                    <!-- 表单底部 -->
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-sm-2">
                            </div>

                            <div class="col-sm-10 col-md-4 formInputDiv">

                                <div class="btn-group">
                                    <button type="submit" class="btn btn-sm btn-primary dataFormSubmit">
                                        保 存
                                    </button>
                                </div>
                                <div class="btn-group">
                                    <button type="reset" class="btn btn-sm btn-default dataFormReset">
                                        重 置
                                    </button>
                                </div>

                                {if !isset($data)}
                                <div class="btn-group float-right createContinueDiv">
                                    <input type="checkbox" class="form-check-input" value="1" id="_create" name="_create" title="继续添加数据">
                                    <label class="form-check-label" for="_create">继续添加</label>
                                </div>
                                {/if}
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>
    /** 表单验证 **/
    $('#dataForm').validate({
        rules: {
                'company_name': {
                required: true,

    },
    'license': {
                required: true,

    },
    'id_card_top': {
                required: true,

    },
    'id_card_back': {
                required: true,

    },
    'cate[]': {
                required: true,

    },
    'nature': {
                required: true,

    },
    'aptitude': {
                required: true,

    },
    
    'name': {
                required: true,

    },
    'phone': {
                required: true,

    },
    'email': {
                required: true,

    },
    'address': {
                required: true,

    },
    'client_num': {
                required: true,

    },
    'car_num': {
                required: true,

    },
    'is_car': {
                required: true,

    },
    'dot_num': {
                required: true,

    },
    

        },
        messages: {
                'company_name': {
               required: "公司名称不能为空",

    },
    'license': {
               required: "营业执照照片不能为空",

    },
    'id_card_top': {
               required: "法人身份证正面不能为空",

    },
    'id_card_back': {
               required: "法人身份证反面不能为空",

    },
    'cate[]': {
               required: "所属类目不能为空",

    },
    'nature': {
               required: "公司性质不能为空",

    },
    'aptitude': {
               required: "纳税人资质不能为空",

    },
    
    'name': {
               required: "联系人姓名不能为空",

    },
    'phone': {
               required: "手机号不能为空",

    },
    'email': {
               required: "邮箱不能为空",

    },
    'address': {
               required: "经营场地地址不能为空",

    },
    
    'is_car': {
               required: "是否具备运输系统不能为空",

    },
    
    

        }
    });
</script>
{/block}